<template>
	<view>
		<view class="header">
			<view class="head_portrait" @click="mycenter">
				<image class="photo" src="../../../static/logo2.png" mode="aspectFill"></image>
				<image class="identity" src="../../../static/logo.png" mode="aspectFill"></image>
			</view>
			<view class="nickname">山东榴弹制烟花研发制造集团</view>
			<view class="autograph">身份名称·这里是个人简介/签名，只展示一行多余省略</view>
		</view>
		<view>
			<uni-grid :column="4" :showBorder="false" @change="business_management">
				<uni-grid-item :index="13">
					<text class="numbers">338</text>
					<text class="texts">我的收藏</text>
				</uni-grid-item>
				<uni-grid-item :index="14">
					<text class="numbers">2344</text>
					<text class="texts">我发布的</text>
				</uni-grid-item>
				<uni-grid-item :index="15">
					<text class="numbers">
						<!-- {{guanzhu}} -->
						142
					</text>
					<text class="texts">我的关注</text>
				</uni-grid-item>
				<uni-grid-item :index="16">
					<text class="numbers">
						<!-- {{fans}} -->
						243
					</text>
					<text class="texts">我的粉丝</text>
				</uni-grid-item>
			</uni-grid>
		</view>
		<view class="my_function">
			<view class="function_title">我的功能</view>
			<uni-grid :column="4" :show-border="false" :square="false" @change="business_management">
				<uni-grid-item :index="1">
					<!-- <image class="menus" src="../../../static/me/Buyer_sorder.png" mode="aspectFill"></image> -->
				<!-- <uni-grid-item :index="1">
					<navigator url="../../mall/order-from/buyers-order"> -->
						<image class="menus" src="../../../static/me/Buyer_sorder.png" mode="aspectFill"></image>
					<text class="menusname">买家订单</text>
				</uni-grid-item>
				<uni-grid-item :index="2">
					<image class="menus" src="../../../static/me/Seller_order.png" mode="aspectFill"></image>
					<text class="menusname">卖家订单</text>
				</uni-grid-item>
				<uni-grid-item :index="3">
					<image class="menus" src="../../../static/me/wallet.png" mode="aspectFill"></image>
					<text class="menusname">钱包</text>
				</uni-grid-item>
				<uni-grid-item :index="4">
					<image class="menus" src="../../../static/me/After_sales.png" mode="aspectFill"></image>
					<text class="menusname">售后</text>
				</uni-grid-item>
				<uni-grid-item :index="5">
					<image class="menus" src="../../../static/me/coupon.png" mode="aspectFill"></image>
					<text class="menusname">优惠券</text>
				</uni-grid-item>
				<uni-grid-item :index="6">
					<image class="menus" src="../../../static/me/Certification_management.png" mode="aspectFill">
					</image>
					<text class="menusname">认证管理</text>
				</uni-grid-item>
				<uni-grid-item :index="7">
					<image class="menus" src="../../../static/me/My_team.png" mode="aspectFill"></image>
					<text class="menusname">我的团队</text>
				</uni-grid-item>
				<uni-grid-item :index="8">
					<image class="menus" src="../../../static/me/bond.png" mode="aspectFill"></image>
					<text class="menusname">保证金</text>
				</uni-grid-item>
				<uni-grid-item :index="9">
					<image class="menus" src="../../../static/me/convention.png" mode="aspectFill"></image>
					<text class="menusname">公约</text>
				</uni-grid-item>
				<uni-grid-item :index="10">
					<image class="menus" src="../../../static/me/business_management.png" mode="aspectFill"></image>
					<text class="menusname">企业管理</text>
				</uni-grid-item>
				<uni-grid-item :index="11">
					<image class="menus" src="../../../static/me/set_up.png" mode="aspectFill"></image>
					<text class="menusname">设置</text>
				</uni-grid-item>
				<uni-grid-item :index="12">
					<image class="menus" src="../../../static/me/About_us.png" mode="aspectFill"></image>
					<text class="menusname">关于我们</text>
				</uni-grid-item>
			</uni-grid>
		</view>
		<view class="my_function">
			<view class="function_title">第三方服务</view>
			<uni-grid :column="4" :showBorder="false">
				<uni-grid-item>
					<image class="menus" src="../../../static/me/waimai.png" mode="aspectFill"></image>
					<text class="menusname">美团外卖</text>
				</uni-grid-item>
				<uni-grid-item>
					<image class="menus" src="../../../static/me/didi.png" mode="aspectFill"></image>
					<text class="menusname">滴滴出行</text>
				</uni-grid-item>
				<uni-grid-item>
					<image class="menus" src="/static/me/xiecheng.png" mode="aspectFill"></image>
					<text class="menusname">携程旅行</text>
				</uni-grid-item>
				<uni-grid-item>
					<image class="menus" src="/static/me/zuche.png" mode="aspectFill"></image>
					<text class="menusname">美团租车</text>
				</uni-grid-item>
			</uni-grid>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				guanzhu: '', // 关注
				fans: '', //粉丝
			};
		},
		onNavigationBarButtonTap(e) {
			console.log(e)
			if (e.text == '   签到') {
				uni.navigateTo({
					url: '../Sign_in/Sign_in'
				});
			} else {
				uni.navigateTo({
					url: '../Invite_friends/Invite_friends'
				});
			}
		},
		onShow() {
			console.log('---------1111'),
				this.goLoginto()
		},
		onLoad() {
			this.getAttention()
			this.getFans()
		},
		methods: {
			goMaijia2() {
				uni.navigateTo({
					url:'../../mall/order-from/buyers-order'
				})
				},
			goLoginto() {
				setTimeout(function() {
						if(uni.getStorageSync('token')==''){
											uni.showToast({
												title:'暂未登陆,快去登陆吧！',
												// title:'',
												icon:'none'
											})
											uni.navigateTo({
												url: '../../login/login'
											})
										}
				},1000)
			},
		goLoginto() {
		    setTimeout(function() {
		     if (uni.getStorageSync('token') == '') {
		      uni.showToast({
		       title: '暂未登陆,快去登陆吧！',
		       icon: 'none'
		      })
		      uni.navigateTo({
		       url: '../../login/login'
		      })
		     }
		    }, 1000)
		   },
			getAttention() {
				var that = this
				that.$http.req.ajax({
					path: ':8066/web/follow/count',
					header: {
						'token': uni.getStorageSync('token')
					},
					afterAjax: (res) => {
						that.guanzhu = res.data
						console.log(res, '关注数据拿取')
					}
				})
			},
			getFans() {
				var that = this
				that.$http.req.ajax({
					path: ':8066/web/follow/followCount',
					header: {
						'token': uni.getStorageSync('token')
					},
					afterAjax: (res) => {
						that.fans = res.data
						console.log(res, '粉丝数据拿取')
					}
				})
			},
			// 个人中心  账号资料
			mycenter() {
				uni.navigateTo({
					url: '../information/information'
				});
			},
			business_management(e) {
				switch (e.detail.index) {
					case 1:
						uni.navigateTo({
							url: '../../mall/order-from/buyers-order?parameter=' + 1
						})
						break;
					case 2:
						uni.navigateTo({
							url: '../../mall/order-from/sell-order-from?parameter=' + 2
						})
						break;
					case 3:
						uni.navigateTo({
							url: '../wallet/wallet'
						});
						break;
					case 4:
						uni.navigateTo({
							url: '../after_sales/index'
						});
						break;
					case 5:
						uni.navigateTo({
							url: '../coupon/coupon'
						});
						break;
					case 6:
						uni.navigateTo({
							url: '../authentication/authentication'
						});
						break;
					case 7:
						uni.navigateTo({
							url: '../My_team/team'
						});
						break;
					case 8:
						uni.navigateTo({
							url: '../bond/bond'
						});
						break;
					case 9:
						uni.navigateTo({
							url: '../convention/convention'
						});
						break;
					case 10:
						uni.navigateTo({
							url: '../business_management/created'
						});
						break;
					case 11:
						uni.navigateTo({
							url: '../set_up/setting'
						});
						break;
					case 12:
						uni.navigateTo({
							url: '../about/about_us'
						});
						break;
					case 13:
						uni.navigateTo({
							url: '../my_collection/my_collection'
						});
						break;
					case 14:
						uni.navigateTo({
							url: '../myrelease/myrelease'
						});
						break;
					case 15:
						uni.navigateTo({
							url: '../my_attention/my_attention?parameter=' + 1
						});
						break;
					case 16:
						uni.navigateTo({
							url: '../my_attention/my_attention?parameter=' + 2
						});
						break;
					default: {
						console.log('都不匹配')
					}
				}

			}
		}
	}
</script>

<style lang="scss">
	.header {
		margin-left: 25rpx;
		margin-top: 36rpx;
		height: 101rpx;
		overflow: hidden;
	}

	.head_portrait {
		width: 101rpx;
		height: 101rpx;
		float: left;

		.photo {
			width: 101rpx;
			height: 101rpx;
			border-radius: 50%;
		}

		.identity {
			width: 36rpx;
			height: 36rpx;
			position: relative;
			bottom: 43rpx;
			float: right;
			border-radius: 50%;
		}
	}

	.nickname {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #21201D;
		padding-left: 25rpx;
		height: 34rpx;
		overflow: hidden;
		display: flex;
	}

	.autograph {
		font-size: 21rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #21201D;
		opacity: 0.65;
		padding-left: 25rpx;
		padding-top: 25rpx;
		overflow: hidden;
		display: flex;
	}

	.numbers {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 600;
		color: #21201D;
		opacity: 1;
		text-align: center;
		margin-top: 47rpx;
	}

	.texts {
		font-size: 21rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #21201D;
		opacity: 0.35;
		text-align: center;
		margin-top: 10rpx;
	}

	.my_function {
		margin: 0rpx 25rpx 0 25rpx;
	}

	.function_title {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #21201D;
		opacity: 1;
		margin: 21rpx 0rpx 0rpx 21rpx;
	}

	.menus {
		width: 61rpx;
		height: 61rpx;
		margin-top: 36rpx;
		margin-left: 56rpx;
		margin-bottom: 9rpx;
	}

	.menusname {
		font-size: 21rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #21201D;
		opacity: 0.65;
		text-align: center;
	}

	.uni-page-head-btn {
		margin: 0rpx 25rpx !important;
	}
</style>
